<template>
  <div class="app-container">
    <basic-table
      :table-title="tableTitle"
      :data-source="dataSource"
      :data-params="dataParams"
      :multiple-table="false"
      class="mt-4"
    >
      <template v-slot:check="scope">
        <span style="color: #0087FE; cursor: pointer;" @click="changeStatus(scope.row)">
          查看
        </span>
      </template>
    </basic-table>

    <Modal
      :show="dialogVisible"
      :descriptions-info="descInfo"
      :descriptions-list="descriptionsList"
      @close="close"
    />
  </div>
</template>
<script>
import BasicTable from '@/components/BasicTable/index.vue'
import Modal from '@/components/Modal/Index'

import { getContracts, getContractDetail } from '@/api/project'

export default {
  name: 'Concat',
  components: { BasicTable, Modal },
  props: {
    projectId: { type: String, default: '' }
  },
  data() {
    return {
      dialogVisible: false,
      dataSource: () => getContracts,
      dataParams: {
        projectId: ''
      },
      tableTitle: [
        {
          label: '数据等级',
          value: 'DataLevel',
          show: true,
          type: 'text'
        },
        {
          label: '省级合同备案编号',
          value: 'ProvinceRecordNum',
          show: true,
          type: 'text'
        },
        {
          label: '合同类别',
          value: 'ContractType',
          show: true,
          type: 'text'
        },
        {
          label: '合同登记编号',
          value: 'ContractRecordNum',
          show: true,
          type: 'text'
        },
        {
          label: '合同金额（万元）',
          value: 'ContractMoney',
          show: true,
          type: 'text'
        },
        {
          label: '发包单位名称',
          value: 'AwardComName',
          show: true,
          type: 'text'
        },
        {
          label: '承包单位名称',
          value: 'ContractComName',
          show: true,
          type: 'text'
        },
        {
          label: '详情',
          show: true,
          type: 'slot',
          slot: 'check'
        }
      ],
      descriptionsList: {
        'ProjectName': '项目名称',
        'ConPrjName': '工程名称',
        'RecordNum': '合同登记编号',
        'ContractNum': '合同编号',
        'ProvinceRecordNum': '省级合同备案编号',
        'ContractMoney': '合同金额(万元)',
        'ContractType': '合同类别',
        'PrjSize': '建设规模',
        'AwardComName': '发包单位名称',
        'AwardComNum': '发包单位统一社会信用代码',
        'ContractComName': '承包单位名称',
        'ContractComNum': '承包单位名称统一社会信用代码',
        'UnionComName': '联合体承包单位名称',
        'UnionComNum': '联合体承包单位统一社会信用代码',
        'ContractDate': '合同签订日期',
        'RegistrationDate': '记录登记时间',
        'DataSource': '数据来源',
        'DataLevel': '数据等级'
      },
      descInfo: null
    }
  },
  created() {
    this.dataParams.projectId = this.projectId
  },
  methods: {
    close(v) {
      this.dialogVisible = v
    },
    //  查看
    changeStatus(v) {
      getContractDetail({
        id: v.Id,
        projectId: this.projectId
      }).then(res => {
        if (res.code === 200) {
          this.dialogVisible = true
          this.descInfo = res.data.detail
        }
      })
    }
  }
}
</script>
